#ifndef LAYERPROCESS_H
#define LAYERPROCESS_H

#include "layerdata.h"
#include <QString>
#include <QTableWidget>
#include <QProgressBar>
#include <QComboBox>


typedef struct{
	int*			pWordIdx;
	int				wordSize;
	int				wordIdx;
	int				lastWordIdx;
	int				totalTries;
	Word			curWord;
	QString			curAnswer;
	QProgressBar*	uiProgress;
	QProgressBar*	uiProgressResult;
}s_Game;

typedef enum{
	e_Sounds_Ok,
	e_Sounds_End,
	e_Sounds_Pop,
	e_Sounds_EnumSize
}e_Sounds;

class LayerProcess: public QThread
{
	
public:
	LayerProcess();
	~LayerProcess();
	void displayAllWords(QTableWidget* widget);
	void displayDicos(QComboBox* combo);
	bool AddWord(QString newWord, QString newTranslation);
	bool DeleteWord(int idx);
	void LoadDico(QString dicoName);
	void ClearDico();
	void CreateDico(QString dicoName);
	void	game_Init(QProgressBar* _uiProgress, QProgressBar *_uiProgress2);
	void	game_randomizeWords();
	QString game_GetWord();
	QString game_GetWordResult();
	bool	game_GetResult(QString answer);
	void	game_close();
	QString getWord();
	void PlaySound(e_Sounds soundName);
	bool	checkDicoInit();
	QString	LoadLastDico();
	void	SaveCurDico(QString dicoName);
	
private:
	LayerData*	pData;
	s_Game		params_game;
	void	game_ResultCounter();
	void	swap(int* pData1, int* pData2);
	
	
//signals:
	//void randomizeFinished();
	
};

#endif // LAYERPROCESS_H
